@extends('admin/layout')

@section('content')
    <script>
        function del()
        {
            if(confirm("确定要删除吗？"))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    </script>
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">订单管理</a></li>
                <li class="active">兑换服务</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12" style="width: 100%;">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">内容</h3>
                        </div>
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @else
                                <div style="width: 100%;">
                                    <span style="color: green;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ Session::get('msg') }}</span>
                                </div>
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <div class="box-body" style="overflow: auto;">
                            <div class="input-group margin">
                                <div style="float: left">
                                    <form action="{{ url('admin/select') }}" method="post" >
                                        {{ csrf_field() }}
                                        <div style="float: left;line-height: inherit">
                                            <input style="width: 150px" type="text" class="form-control" value="请输入会员手机号" disabled>
                                        </div>
                                        <div style="float: left" id="form">
                                            <input style="width: 200px"  name="param" type="text" class="form-control">
                                        </div>
                                        <div style="float: left">
                                            <input  type="submit" class="btn btn-info btn-flat" value="查询">
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <!-- /.box -->
                    </div>
                    <!-- /.row -->
                </div>
            </div>
        </section>
        <!-- /.content -->
    </div>
    <script type="text/javascript" src="{{ asset('client/js/laydate.js') }}"></script>


    <script>
        function select(id) {
//            var id = $('#321321').val();
            var select =  $("#"+id+"_select option:selected").val();
//            alert(select);
//            alert(id);
            var data = {
                id:id,
                select:select
            };
//            console.log(data);
            sed(data);
        }
        function sed(data) {
            console.log(data);
            $.ajax({
                url:'/admin/orders/setStatus',
                data:data,
                type:'GET',
                async:false,
                dataType:'json',
                success:function(res){
                    console.log(res);
                    if(res.error == 1){
//                        window.location.href=window.location.href;
                        layer.msg(res.msg,{time:1500, icon:1, end:function(){location.reload();}});
                    }
                    else{
//                        window.location.href=window.location.href;
                        layer.msg(res.msg);
                    }
                },
                error:function(){
                    layer.msg('error');
                }
            });
        }
    </script>
@stop